<div class="row">
	<div class="panel callout"><h6>Subject Attendance</h6></div>
	<?if(isset($system_message)) echo $system_message;?>
	<?require('grades_nav.php');?>
	<?if(isset($month_att)):?>
		<div class="panel"><h6><?=$subj_data->subj_code . ' (' . $subj_data->subj_desc . ')' ;?></h6></div>
		<?if(!empty($month_att)):?>
			<div id="subj_accordion">
				<?foreach($month_att AS $m):?>
					<h3><?=date('F, Y', strtotime($m->att_date));?></h3>
					<div>
						<table>
							<thead>
								<tr>
									<th rowspan="2"><center>Date</center></th>
									<th colspan="4"><center>Attendance</center></th>
									<th rowspan="2"><center>Action</center></th>
								</tr>
								<tr>
									<th><center>Present</center></th>
									<th><center>Absent</center></th>
									<th><center>Tardy</center></th>
									<th><center>Cut Class</center></th>
								</tr>
							</thead>
							<tbody>
								<?foreach($daily_att AS $d):?>
									<?if(date('m', strtotime($m->att_date)) == date('m', strtotime($d->att_date))):?>
										<tr>
											<td><?=date('F d, Y', strtotime($d->att_date));?></td>
											<td><center><?=$d->p ?></center></td>
											<td><center><?=$d->a ?></center></td>
											<td><center><?=$d->t ?></center></td>
											<td><center><?=$d->c ?></center></td>
											<td>
												<center>
													<a href="<?=site_url(array('teacher', 'view_edit_subject_attendance', $subj_id, $d->att_date));?>" class="button small radius">View/Edit</a>
													<a href="<?=site_url(array('teacher', 'delete_subject_attendance', $subj_id, $d->att_date));?>" class="button small alert confirm_btns">Delete</a>
												</center>
											</td>
										</tr>
									<?endif;?>
								<?endforeach;?>
							</tbody>
						</table>
					</div>
				<?endforeach;?>
			</div>			
		<?endif;?>
	<?else:?>
		<div class="panel"><h6><a href="<?=site_url(array('teacher','new_subject_attendance', $subj_id))?>">Click here</a> to create a record.<h6></div>
	<?endif;?>
</div>